<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加商品</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        :root {
            --primary-color: #1989fa;
            --bg-color: #f5f5f5;
            --card-bg: #fff;
            --text-color: #333;
            --border-color: #eee;
            --error-color: #ff4d4f;
            --success-color: #52c41a;
        }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: var(--bg-color);
            color: var(--text-color);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }
        .header {
            padding: 16px;
            background-color: var(--primary-color);
            color: white;
            text-align: center;
            font-size: 18px;
            position: relative;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .back-btn {
            position: absolute;
            left: 16px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            color: white;
            font-size: 20px;
            cursor: pointer;
            display: flex;
            align-items: center;
            padding: 8px;
        }
        .back-btn i {
            margin-right: 4px;
        }
        .container {
            flex: 1;
            padding: 16px;
            max-width: 800px;
            margin: 0 auto;
            animation: fadeIn 0.3s ease-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .form-section {
            background: white;
            border-radius: 12px;
            padding: 24px;
            margin-bottom: 16px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.05);
            transition: box-shadow 0.3s;
        }
        .form-section:hover {
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }
        .section-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 20px;
            color: var(--text-color);
            border-bottom: 1px solid var(--border-color);
            padding-bottom: 12px;
            display: flex;
            align-items: center;
        }
        .section-title i {
            margin-right: 8px;
            color: var(--primary-color);
        }
        .form-group {
            margin-bottom: 20px;
        }
        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-size: 14px;
            color: var(--text-color);
            font-weight: 500;
        }
        .form-group input,
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 12px;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            font-size: 14px;
            box-sizing: border-box;
            transition: all 0.3s;
        }
        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(25,137,250,0.1);
            outline: none;
        }
        .form-group textarea {
            height: 120px;
            resize: vertical;
            line-height: 1.6;
        }
        .image-upload {
            border: 2px dashed var(--border-color);
            padding: 24px;
            text-align: center;
            border-radius: 8px;
            cursor: pointer;
            margin-bottom: 16px;
            transition: all 0.3s;
            background-color: #fafafa;
        }
        .image-upload:hover {
            border-color: var(--primary-color);
            background-color: #f0f7ff;
        }
        .image-upload i {
            font-size: 32px;
            color: var(--primary-color);
            margin-bottom: 8px;
        }
        .image-upload-text {
            font-size: 14px;
            color: var(--text-color);
            margin-bottom: 4px;
        }
        .image-upload-hint {
            color: #999;
            font-size: 12px;
        }
        .btn-submit {
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 14px 0;
            border-radius: 8px;
            width: 100%;
            font-size: 16px;
            cursor: pointer;
            margin-top: 24px;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .btn-submit i {
            margin-right: 8px;
        }
        .btn-submit:hover {
            background-color: #1677ff;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(25,137,250,0.2);
        }
        .btn-submit:active {
            transform: translateY(0);
        }
        .price-input-group {
            position: relative;
        }
        .price-input-group input {
            padding-left: 24px;
        }
        .price-input-group::before {
            content: '¥';
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: #999;
        }
    </style>
</head>
<body>
    <div class="header">
        <button class="back-btn" onclick="history.back()"><i class="fas fa-arrow-left"></i></button>
        添加商品
    </div>
    
    <div class="container">
        <div class="form-section">
            <div class="section-title">
                <i class="fas fa-info-circle"></i>基本信息
            </div>
            <div class="form-group">
                <label>商品名称</label>
                <input type="text" placeholder="请输入商品名称" maxlength="50">
            </div>
            <div class="form-group">
                <label>商品分类</label>
                <select>
                    <option value="">请选择商品分类</option>
                    <option value="1">数码电子</option>
                    <option value="2">服装鞋包</option>
                    <option value="3">美妆护肤</option>
                    <option value="4">食品生鲜</option>
                </select>
            </div>
            <div class="form-group">
                <label>商品图片</label>
                <div class="image-upload">
                    <i class="fas fa-cloud-upload-alt"></i>
                    <div class="image-upload-text">点击或拖拽上传图片</div>
                    <div class="image-upload-hint">建议尺寸：800x800px，支持jpg、png格式</div>
                </div>
            </div>
        </div>

        <div class="form-section">
            <div class="section-title">
                <i class="fas fa-yen-sign"></i>价格库存
            </div>
            <div class="form-group">
                <label>销售价格</label>
                <div class="price-input-group">
                    <input type="number" placeholder="请输入销售价格" step="0.01" min="0">
                </div>
            </div>
            <div class="form-group">
                <label>商品库存</label>
                <input type="number" placeholder="请输入商品库存" min="0">
            </div>
        </div>

        <div class="form-section">
            <div class="section-title">
                <i class="fas fa-file-alt"></i>商品详情
            </div>
            <div class="form-group">
                <label>商品描述</label>
                <textarea placeholder="请输入商品描述" maxlength="1000"></textarea>
            </div>
        </div>

        <button class="btn-submit">
            <i class="fas fa-check"></i>确认添加
        </button>
    </div>

    <script>
        // 添加表单验证
        document.querySelector('.btn-submit').addEventListener('click', function() {
            const name = document.querySelector('input[type="text"]').value;
            const category = document.querySelector('select').value;
            const price = document.querySelector('input[type="number"]').value;
            const stock = document.querySelector('input[type="number"]:last-of-type').value;
            
            if (!name || !category || !price || !stock) {
                alert('请填写完整的商品信息');
                return;
            }
            
            // 这里添加提交逻辑
            alert('商品添加成功！');
            history.back();
        });

        // 添加输入框焦点效果
        const inputs = document.querySelectorAll('input, select, textarea');
        inputs.forEach(input => {
            input.addEventListener('focus', () => {
                input.parentElement.style.borderColor = 'var(--primary-color)';
            });
            input.addEventListener('blur', () => {
                input.parentElement.style.borderColor = 'var(--border-color)';
            });
        });
    </script>
</body>
</html>